<template>
  <div id="app">
    <!-- 路由出口 -->
    <router-view />
  </div>
</template>

<script>
export default {
  name: "App",
  mounted() {
    if (this._isMobile()) {
      const phone = confirm("请用电脑预览,确认即进入git地址!!!");
      // this.$router.replace('/m_index');
      if (phone) {
        window.location.href = "https://gitee.com/ChenLong1999/initial-cli-headline";
      } else {
        document.body.style.display = "none";
      }
    } else {
      // alert("pc端");
      // this.$router.replace('/pc_index');
    }
  },
  methods: {
    _isMobile() {
      const flag = navigator.userAgent.match(
        /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
      );
      localStorage.setItem("ismobile", flag ? 1 : 0);
      return flag;
    },
  },
};
</script>
<style lang="less">
</style>
